/**
 * @author Qi
 */
function EventHandlers(){
    this.selectorImages = null;
    this.imgIDs = ["sel_xx", "sel_09", "sel_ac", "sel_df", "sel_gi", "sel_jl", "sel_mo", "sel_pr", "sel_su", "sel_vx", "sel_yz"];
    this.init = function(){
        this.selectorImages = new Array();
        //Load images from the above array and store them in selectorImages
        for (var i = 0; i < this.imgIDs.length; i++) {
            var sid = this.imgIDs[i];
			this.selectorImages[sid] = new Image();
			this.selectorImages[sid].src = "img/" + sid + ".gif";
			this.selectorImages[sid + "_over"] = new Image();
			this.selectorImages[sid + "_over"].src = "img/" + sid + "_over.gif"; 
        }
		var inputFields = document.getElementsByTagName("input");
		for(var i = 0;i < inputFields.length;i++){
			inputFields[i].onfocus = this.ifFocus;
			inputFields[i].onblur = this.ifBlur;
		}
    };
	this.ifFocus = function(){
		this.style.backgroundColor = "#ffffa0";
	};
	this.ifBlur = function(){
		this.style.backgroundColor = "#ffffff";
	};
	this.stOver = function(inTab){
		inTab.src = this.selectorImages[inTab.id + "_over"].src;
	};
	this.stOut = function(inTab){
		if(contactManager.currentTab != inTab.id.substr(4,2)){
			inTab.src = this.selectorImages[inTab.id].src;
		}
	};
	this.stClick = function(inTab){
		for(var i = 0;i < this.imgIDs.length;i++){
			var sid = this.imgIDs[i];
			dojo.byId(sid).src = this.selectorImages[sid].src;
		}
		inTab.src = this.selectorImages[inTab.id + "_over"].src;
		contactManager.currentTab = inTab.id.substr(4,2);
		contactManager.displayContactList();
	};
	this.clOver = function(inContact){
		inContact.className = "cssContactListOver";
	};
	this.clOut = function(inContact){
		if(inContact.getAttribute("altRow") == "true") {
			inContact.className = "cssContactListAlternate";
		}else {
			inContact.className = "cssContactListNormal";
		}
	};
	
}
